﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using System.Data.Linq;
using System.Data.SqlClient;
using Website.Logger;
using UtilityExtensions;
using System.Web.Script.Services;
using System.Web.Services;
using BOL;

namespace UILGestion.Main.Inventario
{
    public partial class ValorizacionProyListForm : System.Web.UI.Page
    {

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                try
                {
                    
                    menuCtrl1.loadMenuMain();
                    FormatForm();


                }
                catch (SqlException sqlex)
                {
                    WebServerSideSqlError.Log(sqlex);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                     "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);


                }
                catch (Exception ex)
                {
                    WebServerSideError.Log(ex);
                    ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                     "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);

                }


            }
        }

        private void FormatForm()
        {
           
            ShowAllComboBox();
            

        }
        protected void ShowAllComboBox()


        {
            int idEmpleado = int.Parse(System.Web.HttpContext.Current.Session["idEmpleado"].ToString());

            empresaDDL.DataTextField = "descripcion";
            empresaDDL.DataValueField = "idInternal";
            empresaDDL.DataSource = new BOL.ListValueBL().GetEmpresasXEmpleado(idEmpleado);
            empresaDDL.DataBind();
        }


        protected void button(object sender, EventArgs e)
        {
            try
            {
                //if (((Button)sender).ID == BuscarBtn.ID)
                //{
                //    //proyectoListGrid1.DataBind();
                //}
                //if (((Button)sender).ID == nuevaVentaButton.ID)
                //{
                //    Response.Redirect("UILocalizacionEditForm.aspx?type=A&idEtapa={0}".Fmt(idEtapa.Value), true);
                //}
            }
            catch (SqlException sqlex)
            {
                WebServerSideSqlError.Log(sqlex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + sqlex.Message.Replace("'", "") + "');", true);


            }
            catch (Exception ex)
            {
                WebServerSideError.Log(ex);
                ScriptManager.RegisterClientScriptBlock(this, typeof(Page),
                 "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);

            }
             
        }

        protected void localizacionTXT_TextChanged(object sender, EventArgs e)
        {

        }
       
    }
}